package com.ruoyi.web.controller.base;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.base.domain.BusWaterRainfallMinutedata;
import com.ruoyi.base.service.IBusWaterRainfallMinutedataService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 降雨量监测数据Controller
 * 
 * @author ruoyi
 * @date 2025-08-20
 */
@RestController
@RequestMapping("/rainfall")
public class BusWaterRainfallMinutedataController extends BaseController
{
    @Autowired
    private IBusWaterRainfallMinutedataService busWaterRainfallMinutedataService;

    /**
     * 查询降雨量监测数据列表
     */
//    @PreAuthorize("@ss.hasPermi('system:MINUTEDATA:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusWaterRainfallMinutedata busWaterRainfallMinutedata)
    {
        startPage();
        List<BusWaterRainfallMinutedata> list = busWaterRainfallMinutedataService.selectBusWaterRainfallMinutedataList(busWaterRainfallMinutedata);
        return getDataTable(list);
    }

    /**
     * 导出降雨量监测数据列表
     */
//    @PreAuthorize("@ss.hasPermi('system:MINUTEDATA:export')")
//    @Log(title = "降雨量监测数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusWaterRainfallMinutedata busWaterRainfallMinutedata)
    {
        List<BusWaterRainfallMinutedata> list = busWaterRainfallMinutedataService.selectBusWaterRainfallMinutedataList(busWaterRainfallMinutedata);
        ExcelUtil<BusWaterRainfallMinutedata> util = new ExcelUtil<BusWaterRainfallMinutedata>(BusWaterRainfallMinutedata.class);
        util.exportExcel(response, list, "降雨量监测数据数据");
    }

    /**
     * 获取降雨量监测数据详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:MINUTEDATA:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busWaterRainfallMinutedataService.selectBusWaterRainfallMinutedataById(id));
    }

    /**
     * 新增降雨量监测数据
     */
//    @PreAuthorize("@ss.hasPermi('system:MINUTEDATA:add')")
//    @Log(title = "降雨量监测数据", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody BusWaterRainfallMinutedata busWaterRainfallMinutedata)
    {
        return toAjax(busWaterRainfallMinutedataService.insertBusWaterRainfallMinutedata(busWaterRainfallMinutedata));
    }

    /**
     * 修改降雨量监测数据
     */
   // @PreAuthorize("@ss.hasPermi('system:MINUTEDATA:edit')")
   // @Log(title = "降雨量监测数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusWaterRainfallMinutedata busWaterRainfallMinutedata)
    {
        return toAjax(busWaterRainfallMinutedataService.updateBusWaterRainfallMinutedata(busWaterRainfallMinutedata));
    }

    /**
     * 删除降雨量监测数据
     */
    @PreAuthorize("@ss.hasPermi('system:MINUTEDATA:remove')")
    @Log(title = "降雨量监测数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busWaterRainfallMinutedataService.deleteBusWaterRainfallMinutedataByIds(ids));
    }
}
